package org.ielts.repository;

import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.classic.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.ielts.domain.base.Student;
import org.ielts.domain.log.AppointConsultorLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.yifeng.dao.HibernateRepository;
import com.yifeng.sitemap.SiteMap;

@Repository
public class AppointConsultorLogRepository extends HibernateRepository<AppointConsultorLog, String> {

	public long countByConsultant(String id) {
		DetachedCriteria detachedCriteria = createDetachedCriteria();

		detachedCriteria.createCriteria("consultor").add(Restrictions.eq("id", id))
				.setProjection(Projections.count("id"));

		long total = firstLongQuery(detachedCriteria);

		return total;
	}
}
